package practice06;

/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: practice06
 * @ClassName: Dog
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/12/6 8:45
 * @Copyright 大牛版板所有
 */
public class Dog {
    private String name;
    private String gender;
    private int age;
    private String breed;

    public Dog(String name, String gender, int age, String breed) {
        this.setName(name);
        this.setGender(gender);
        this.setAge(age);
        this.setBreed(breed);
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getGender() {
        return gender;
    }
    public void setGender(String gender) {
        if ("雄性".equals(gender) || "雌性".equals(gender)){
            this.gender = gender;
        }
        else {
            this.gender = "雄性";
            System.out.println("性别只能是雄性或雌性！");
        }
    }

    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }

    public String getBreed() {
        return breed;
    }
    public void setBreed(String breed) {
        this.breed = breed;
    }


    public void shout(){
        System.out.println("我的名字叫："+this.getName()+"，今年已经"+this.getAge()+"岁了，性别为："+this.getGender()
                            +"，属于"+this.getBreed()+"品种");
    }

    public void run(){
        if (this.getAge()>1){
            System.out.println("我叫"+this.getName()+"，今年已经"+this.getAge()+"岁了，我既能够‘跑’又能够‘咬人！’");
        }
        else {
            System.out.println("我叫"+this.getName()+"，今年已经"+this.getAge()+"岁了，我只能够‘跑’！");
        }
    }

    public static void main(String[] args) {
        Dog dog = new Dog("飞飞","雄性",3,"哈士奇");

        dog.run();
        dog.shout();
    }
}
